import { ConfigBase } from "./configBase/ConfigBase";
import { TAmuletConfig } from "../../../Message/Db/Tables/TAmuletConfig";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { ClassTypesUtil } from "../view/common/ClassTypesUtil";
type int = number;
//class MagicWeaponConfig
    
    export  class MagicWeaponConfig extends ConfigBase
    {
       

        public /* override */ getKey(arg1: Object): Object
        {
            return arg1.color + "_" + arg1.level + "_" + arg1.type;
        }

        public getItemByTypeColorLevel(arg1: int, arg2: int, arg3: int): TAmuletConfig
        {
            var loc1;
            if ((loc1 = getConfigByKeys(["type", "color", "level"], [arg1, arg2, arg3])) && loc1.length > 0) 
            {
                return loc1[0] as TAmuletConfig;
            }
            return null;
        }

        public getItemByTypeLevel(arg1: int, arg2: int): TAmuletConfig
        {
            var loc1=getConfigByKeys(["type", "level"], [arg1, arg2]);
            if (loc1 && loc1.length > 0) 
            {
                return loc1[0] as TAmuletConfig;
            }
            return null;
        }

        public getMagicWeaponBestShow(arg1: int): TAmuletConfig
        {
            var loc1=getConfigByKeys(["type", "color"], [8, arg1]);
            if (loc1 && loc1.length > 0) 
            {
                return loc1[0] as TAmuletConfig;
            }
            return null;
        }

        public getMaxLvByTypeColor(arg1: int, arg2: int): int
        {
            var loc2=null;
            var loc1=getConfigByKeys(["type", "color"], [arg1, arg2]);
            if (loc1 && loc1.length > 0) 
            {
                if (loc2 = loc1[0] as TAmuletConfig) 
                {
                    return loc2.level;
                }
            }
            return 0;
        }

        public getMaxAddByTypeColor(arg1: int, arg2: int): number
        {
            var loc2=null;
            var loc1=getConfigByKeys(["type", "color"], [arg1, arg2]);
            if (loc1 && loc1.length > 0) 
            {
                loc1.sortOn(["add"], Array.DESCENDING | Array.NUMERIC);
                if (loc2 = loc1[0] as TAmuletConfig) 
                {
                    return loc2.add / 100;
                }
            }
            return 0;
        }

        protected /* override */ initConfig(): void
        {
            var loc2=null;
            var loc3=null;
            super.initConfig();
            var loc1=ConfigManager.instance.getJSONByFileName("t_amulet_config.json");
            var loc4=0;
            var loc5=loc1;
            for(loc2 of loc5) 
            {
                loc3 = new TAmuletConfig();
                ClassTypesUtil.copyValue(loc3, loc2);
                _data[this.getKey(loc3)] = loc3;
            }
            return;
        }

        public static get instance(): MagicWeaponConfig
        {
            if (MagicWeaponConfig._instance == null) 
            {
                MagicWeaponConfig._instance = new MagicWeaponConfig();
            }
            return MagicWeaponConfig._instance;
        }

        public /* const */GuideBookURLS: Array<any>=["fabaGuideBookPage1.swf", "fabaGuideBookPage2.swf", "fabaGuideBookPage3.swf", "fabaGuideBookPage4.swf", "fabaGuideBookPage5.swf"];

        /* internal */ static /* var */_instance: MagicWeaponConfig;
    }
